package com.surelution.lansao.wxmp.partner

import org.codehaus.groovy.grails.commons.ConfigurationHolder;

import com.surelution.lansao.Member
import com.surelution.lansao.Partner
import com.surelution.lansao.X
import com.surelution.whistle.core.Attribute
import com.surelution.whistle.core.BaseAction


class ConfigureGuideAction extends BaseLansaoPartnerAction {

	@Override
	public boolean accept() {
		!partner.active
	}

	@Override
	public void execute() {
		def x = new X(who: partner.id, uuid:UUID.randomUUID().toString(), createdAt:new Date())
		x.save(flush:true)
		def link = """<a href="${ConfigurationHolder.config.partner.root}partnerInfo/index?flashId=${x.uuid}"> 注册微信订餐网站</a>"""
		put(new Attribute(Attribute.KEY_Content, "您尚未注册微信系统。本微信账号是专为‘微信订餐联盟’提供的，如需注册您专属的微信订餐网站，${link}"))
	}
}
